#!/usr/bin/env bash
base_path=~/docker/loki/alloy
script_pwd=$(dirname "$0")
container_name=loki-alloy

rm -rf $base_path/config 
mkdir -p $base_path/{config,data}
cp -r $script_pwd/config.alloy $base_path/config/.

docker network create loki

docker rm -f $container_name

docker run -d \
--name $container_name \
-v $base_path/config/config.alloy:/etc/alloy/config.alloy:ro \
-v $base_path/data:/var/lib/alloy/data \
-v /var/logs:/var/logs \
--network loki \
grafana/alloy:latest \
run --server.http.listen-addr=0.0.0.0:12345 \
--storage.path=/var/lib/alloy/data \
/etc/alloy/config.alloy